﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TT.Module.sysLogin;
using SfcorpDLL.dao;
using TT.ORM;
using TT.Module.frmUsers;
using DevExpress.XtraNavBar;
using System.Data;

namespace SfcorpDLL.biz
{
    public class bizSfcorp
    {
        TT.Module.GetSqliBaseData bzSqliBaseData;

        etyBaeSystemParamter basSysParam;
        daoSfcorp doSfcorp;

        public bizSfcorp(etyBaeSystemParamter ieyBasClassDeclare, NavItemCollection barItems)
        {
            basSysParam = ieyBasClassDeclare;
            doSfcorp = new daoSfcorp(basSysParam);

            bzSqliBaseData = new TT.Module.GetSqliBaseData(basSysParam.SqliBaseHelp);

            //设置权限
            bizUsers bzUser = new bizUsers(basSysParam.SqlHelp, basSysParam.PORT_CODE);
            bzUser.SetMainSecrity(barItems, basSysParam.UserID);
        }

        #region sqlite本地数据处理
        //取得基础表参数
        public IList<etyCodeRef> GetBaseTableSource(string iSourceName)
        {
            return bzSqliBaseData.GetBaseData(basSysParam.PORT_CODE, iSourceName);
        }
        //取得SQLite数据
        public IList<T> GetBaseTableSource<T>(string iSourceName)
        {
            return bzSqliBaseData.GetBaseData<T>(basSysParam.PORT_CODE, iSourceName);
        }

        //统一取得下拉数据源
        public IList<TT.ORM.etyCodeRef> GetComboboxSource(string iItem, string iCode)
        {
            return bzSqliBaseData.GetComboboxSource(iItem, iCode);
        }

        //刷新表
        public bool RefreshSqliData(string iRefreshName)
        {
            return bzSqliBaseData.RefreshSqliData(iRefreshName);
        }

        //取得SQLite数据
        public IList<T> GetBaseTableSource<T>(string iSourceName, string iRefreshName)
        {
            return bzSqliBaseData.GetBaseData<T>(basSysParam.PORT_CODE, iSourceName, iRefreshName);
        }

        #endregion 
    }
}
